package edu.zju.gis.dbfg.model.statistic;

import lombok.Getter;
import lombok.Setter;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.Option;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.Serializable;

@Getter
@Setter
public class LUAreaStatisticArgs2D implements Serializable{
    private final static Logger logger = LoggerFactory.getLogger(LUAreaStatisticArgs2D.class);

    @Option(name = "-output",usage = "输出文件路径", required = true)
    private String output;

    @Option(name = "-input1",usage = "输入数据,extent", required = true)
    private String input1;

    @Option(name = "-type1",usage = "输入数据类型,extent", required = true)
    private String type1;

//    @Option(name = "-id1Index",usage = "输入数据类型,extent")
//    private String id1Index;

    @Option(name = "-input2",usage = "输入面状数据,target", required = true)
    private String input2;

    @Option(name = "-type2",usage = "输入数据类型,extent", required = true)
    private String type2;

    /**
     * dlbm码的标志，对于wkt文件，则是数字，对于shapefile文件，则是字段名
     */
    @Option(name = "-dlbmIndex2",usage = "分类字段(dlbm),target")
    private String dlbmIndex2="DLBM";

    @Option(name = "-zldwdmIndex2",usage = "行政区划字段,target")
    private String zldwdmIndex2="ZLDWDM";

    @Option(name = "-areaIndex2",usage = "面积字段(TBMJ),target")
    private String areaIndex2="TBMJ";

    @Option(name = "-jareaIndex2",usage = "净面积字段(TBDLMJ),target")
    private String jareaIndex2="TBDLMJ";

    @Option(name = "-kcdlxsIndex2",usage = "扣除地类系数字段(KCDLXS),target")
    private String kcdlxsIndex2="TKXS";

    @Option(name = "-kcdlbmIndex2",usage = "扣除地类编码字段(KCDLBM),target")
    private String kcdlbmIndex2="KCDLBM";

    @Option(name = "-tbbhIndex2",usage = "图斑编号字段(TBBH),target")
    private String tbbhIndex2="TBBH";

    @Option(name = "-tbybhIndex2",usage = "图斑预编号字段(TBYBH),target")
    private String tbybhIndex2="TBYBH";

    @Option(name = "-xzdwmjIndex2",usage = "线状地物字段(XZDWMJ),target")
    private String xzdwmjIndex2="XZDWMJ";

    @Option(name = "-lxdwmjIndex2",usage = "零星地物面积字段(LXDWMJ),target")
    private String lxdwmjIndex2="LXDWMJ";

    @Option(name = "-scaleIndex2",usage = "统计级别（省、市、县）")
    private String scaleIndex2="XIAN";



    @Option(name = "-input3",usage = "输入线状数据,target", required = true)
    private String input3;

    @Option(name = "-type3",usage = "输入数据类型,extent", required = true)
    private String type3;

    /**
     * dlbm码的标志，对于wkt文件，则是数字，对于shapefile文件，则是字段名
     */
    @Option(name = "-dlbmIndex3",usage = "分类字段(dlbm),target")
    private String dlbmIndex3="DLBM";

    @Option(name = "-kctbdwdm1Index3",usage = "扣除图斑单位代码1(KCTBDWDM1),target")
    private String kctbdwdm1Index3="KCTBDWDM1";

    @Option(name = "-kctbdwdm2Index3",usage = "扣除图斑单位代码2(KCTBDWDM2),target")
    private String kctbdwdm2Index3="KCTBDWDM2";

    @Option(name = "-kctbbh1Index3",usage = "扣除图斑编号1(KCTBBH1),target")
    private String kctbbh1Index3="KCTBBH1";

    @Option(name = "-kctbbh2Index3",usage = "扣除图斑编号2(KCTBBH2),target")
    private String kctbbh2Index3="KCTBBH2";

    @Option(name = "-kcblIndex3",usage = "扣除比例字段(KCBL),target")
    private String kcblIndex3="KCBL";

    @Option(name = "-cdIndex3",usage = "长度字段(CD),target")
    private String cdIndex3="CD";

    @Option(name = "-kdIndex3",usage = "宽度字段(KD),target")
    private String kdIndex3="KD";


    @Option(name = "-input4",usage = "输入点状数据,target", required = true)
    private String input4;

    @Option(name = "-type4",usage = "输入数据类型,extent", required = true)
    private String type4;

    @Option(name = "-dlbmIndex4",usage = "分类字段(dlbm),target")
    private String dlbmIndex4="DLBM";

    @Option(name = "-zldwdmIndex4",usage = "行政区划字段,target")
    private String zldwdmIndex4="ZLDWDM";

    @Option(name = "-zltbbhIndex4",usage = "坐落图斑编号字段,target")
    private String zltbbhIndex4="ZLTBBH";

    @Option(name = "-mjIndex4",usage = "面积字段,target")
    private String mjIndex4="MJ";

    @Option(name = "-crs1",usage = "extent crs")
    private String crs1 = "4326";

    @Option(name = "-crs2",usage = "target crs")
    private String crs2 = "4326";

    @Option(name = "-crs3",usage = "extent crs")
    private String crs3 = "4326";

    @Option(name = "-crs4",usage = "target crs")
    private String crs4 = "4326";

    @Option(name = "-parallelize", usage="parallelize num")
    private int partitionNum = 4;

    public  static LUAreaStatisticArgs2D initArgs(String args[]){
        LUAreaStatisticArgs2D mArgs = new LUAreaStatisticArgs2D();
        CmdLineParser parser = new CmdLineParser(mArgs);
        try {
            parser.parseArgument(args);
            return mArgs;
        } catch (CmdLineException e) {
            logger.error(e.getLocalizedMessage());
            return null;
        }
    }
}
